package com.demo.server;

import java.util.List;
import java.util.Map;

import com.demo.dao.IIndexDao;
import com.demo.entity.CustomCrud;
import com.demo.entity.base.Page;
import com.demo.web.base.BaseResult;
import com.jweb.annotaion.JAutowired;
import com.jweb.util.FormatUtil;

public class IndexServer {

	public @JAutowired CustomCrud cc;

	@JAutowired
	public IIndexDao dao;

	public BaseResult<Map<String, String>> listPayCompant(int currentPage, String licenseNumber, String companyName, String busType, int batch) {
		Page page = new Page(currentPage);
		List<Map<String, String>> resultList = dao.listPayCompany(licenseNumber, companyName, busType, batch, page);
		int allCounts = dao.getPayCompanyCount(licenseNumber, companyName, busType, batch);
		BaseResult<Map<String, String>> basepage = new BaseResult<Map<String, String>>(page, allCounts);
		basepage.setList(resultList);
		return basepage;
	}

	/**
	 * 线程安全测试
	 */
	public CustomCrud asynTest() {
		cc.setId(cc.getId() + 1);
		System.out.println(FormatUtil.toJSONString(cc));
		return cc;
	}
}
